package com.demo2do.fms.admin.service.supplier;

import java.util.List;

import com.demo2do.core.entity.page.Page;
import com.demo2do.fms.admin.entity.export.supplier.SupplierSheet;
import com.demo2do.fms.admin.entity.search.supplier.SubSupplierSearch;
import com.demo2do.fms.admin.entity.search.supplier.SupplierSearch;
import com.demo2do.fms.admin.entity.security.Login;
import com.demo2do.fms.admin.service.DataService;
import com.demo2do.fms.entity.authority.Branch;
import com.demo2do.fms.entity.supplier.SupplierSource;
import com.demo2do.fms.entity.supplier.common.AuditStatus;
import com.demo2do.fms.entity.supplier.common.Level;
import com.demo2do.fms.entity.supplier.common.Supplier;
import com.demo2do.fms.entity.supplier.common.SupplierEvent;
import com.demo2do.fms.entity.supplier.common.SupplierEventType;
import com.demo2do.fms.entity.supplier.common.SupplierModifiedVersion;
import com.demo2do.fms.entity.supplier.common.SupplierRecommendation;
import com.demo2do.fms.entity.supplier.common.Type;

/**
 * 
 * @author Ysy
 *
 */
public interface SupplierService extends DataService<Supplier> {
    
    /**
     * 
     * @param supplierId
     * @return
     */
    public SupplierRecommendation getSupplierRecommendation(Long supplierId);
    
    /**
     * 
     * @param ids
     * @return
     */
    public List<Supplier> list(List<Long> ids);
    
    /**
     * 
     * @param type
     * @param status
     * @return
     */
    public List<Supplier> list(Type type, List<AuditStatus> status);
    
    /**
     * @param type
     * @param status
     * @param login
     * @return
     */
    public List<Supplier> list(Type type, List<AuditStatus> status, Login login);
    
    /**
     * 
     * @param page
     * @return
     */
    public List<Supplier> list(Page page);
    
    /**
     * list supplier source by type and code
     * 
     * @param type
     * @param code
     * @return
     */
    public List<SupplierSource> obtain(Type type, String code);

    /**
     * 
     * @param supplierLevel
     * @return
     */
    public List<Supplier> list(Level supplierLevel);
    
    /**
     * @param level
     * @param type
     * @return
     */
    public List<Supplier> list(Level level, Type type);
    
    /**
     * @param search
     * @return
     */
    public List<SupplierSheet> export(SubSupplierSearch search);
    
    /**
     * @param supplier
     * @param parentId
     * @param operator
     */
    public void create(Supplier supplier, Long parentId, Long operator);
    
    /**
     * @param search
     * @return
     */
    public int countSubSupplier(SubSupplierSearch search);
    
    /**
     * count suppliers by parent
     * 
     * @param parent
     * @return
     */
    public int countSponsoredSupplier(Supplier parent);
    
    /**
     * count rectify supplier
     * 
     * @param login
     * @return
     */
    public int countRectifySupplier(Login login);
    
    /**
     * @param search
     * @return
     */
    public int countRectify(SupplierSearch search);
    
    /**
     * @param login
     * @param page
     * @return
     */
    public List<Supplier> listRectifySupplier(Login login, Page page);
    
    /**
     * @param search
     * @param page
     * @return
     */
    public List<Supplier> listRectify(SupplierSearch search, Page page);
    
    /**
     * 
     * @param parent
     * @return
     */
    public List<Supplier> listSponsoredSupplier(Supplier parent);
    
    /**
     * @param parent
     * @return
     */
    public List<Long> listSponsoredSupplierId(Supplier parent);
    
    /**
     * @param parentCode
     * @param parentName
     * @return
     */
    public List<Long> listSponsoredSupplierId(String parentCode, String parentName);
    
    /**
     * list suppliers by parent and page
     * 
     * @param parent
     * @param page
     * @return
     */
    public List<Supplier> listSponsoredSupplier(Supplier parent, Page page);
    
    /**
     * list parent supplier by sub supplier
     * 
     * @param supplier
     * @return
     */
    public List<Supplier> listParentSupplier(Supplier supplier);
    
    /**
     * 
     * @param supplierId
     * @param type
     * @return
     */
    public SupplierEvent getSupplierEvent(Long supplierId , SupplierEventType type);
    
    /**
     * @param login
     * @return
     */
    public List<Supplier> listSubSupplier(Login login);
    
    /**
     * @param login
     * @param type
     * @return
     */
    public List<Supplier> listSubSupplier(Login login, Type type);
    
    /**
     * @param login
     * @param page
     * @return
     */
    public List<Supplier> listSubSupplier(Login login, Page page);
    
    /**
     * @param login
     * @return
     */
    public List<Long> listSubSupplierId(Login login);
    
    /**
     * @param search
     * @return
     */
    public List<Supplier> listSupplier(SupplierSearch search);
    
    /**
     * 
     * @param supplier
     * @param status
     * @param operator
     */
    public void rectify(Supplier supplier, AuditStatus status, Long operator);
    
    /**
     * @param supplier
     * @param parents
     * @param operator
     */
    public void changeLevel(Supplier supplier, List<Long> parents, Long operator);
    
    /**
     * @param supplier
     * @param parents
     * @param operator
     */
    public void changeParent(Supplier supplier, List<Long> parents, Long operator);
    
    /**
     * @param supplier
     * @param branch
     * @param operator
     */
    public void changeBranch(Supplier supplier, Branch branch, Long operator);
    
    /**
     * @param supplier
     * @param operator
     */
    public void syncShortname(Supplier supplier, Long operator);
    
    /**
     * @param supplier
     * @param operator
     */
    public void delete(Supplier supplier, Long operator);
    
    /**
     * 
     * @param supplier
     * @return
     */
    public SupplierModifiedVersion getSupplierModifiedVersion(Supplier supplier);
    
}
